package spring.cloud.tasks.api.database.repository;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import spring.cloud.tasks.api.database.entity.TaskConfigurationDto;

import java.util.List;
import java.util.Map;

@Repository
public interface TaskConfigurationDtoRepository {
    int insert(TaskConfigurationDto taskConfigurationDto);

    int update(TaskConfigurationDto taskConfigurationDto);

    int delete(Long id);

    void updatePreferExecutorIdList(TaskConfigurationDto taskConfigurationDto);

    TaskConfigurationDto getTaskConfigurationDtoByNameSpaceAndTaskId(@Param("nameSpace") String nameSpace, @Param("taskId") String taskId);

    //
    int deleteByNameSpace(String nameSpace);

    List<TaskConfigurationDto> getTaskConfigurationDtoListByNameSpace(@Param("nameSpace") String nameSpace);

    List<String> getTaskIdListByNameSpace(@Param("nameSpace") String nameSpace);

    //
    int getTaskConfigurationDtoListCountByNameSpaceWithCondition(@Param("nameSpace") String nameSpace,
                                                                 @Param("condition") Map<String, Object> condition);

    List<TaskConfigurationDto> getTaskConfigurationDtoListByNameSpaceWithCondition(@Param("nameSpace") String nameSpace,
                                                                                   @Param("condition") Map<String, Object> condition);


}